﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyMainSite.Models.BaseModel>" %>

<% foreach (var p in Model.Projects)
   {
       if (!String.IsNullOrEmpty(Model.CurrentProject))
       {
           if (p.FriendlyUrl.ToLower().Trim() != Model.CurrentProject.ToLower().Trim())
               continue;
       }
       %>
    <article>

		<header>
			<a href="/projects/index/<%: p.FriendlyUrl %>" class="menuItem"><%: p.Name %></a>
		</header>
					
		<section>
			<img class="projectImage" src="/projects/images/<%: p.ProjectId %>" alt="<%: p.Name %>" />
            <%= p.Description %>
			<div class="clear"></div>
            <% if (p.ProjectFeatures.Count > 0)
               { %>
                <ul>
                    <% foreach (var f in p.ProjectFeatures)
                       { %>
                        <li><%: f.Feature %></li>
                    <% } %>
                </ul>
            <% } %>
		</section>

		<% if (p.ProjectBuilds.Count > 0)
		{ %>
			<section>
				<% Html.RenderPartial("ProjectBuilds", p.ProjectBuilds.ToList()); %>
			</section>
		<% } %>

		<footer>
			<% if (!String.IsNullOrWhiteSpace(p.SourceCodeUrl))
			{ %>
				<a class="viewSourceCode" href="<%: p.SourceCodeUrl %>" title="View Source Code">View Source Code</a>
			<% } %>

			<% if (!String.IsNullOrWhiteSpace(p.BugzXUrl))
			{ %>
				<a class="viewBugzX" href="<%: p.BugzXUrl %>" title="View BugzX Bugz">View BugzX Bugs</a>
			<% } %>

			<% if (!String.IsNullOrWhiteSpace(p.AndroidMarketUrl))
			{ %>
				<a class="viewAndroidMarket" href="<%: p.AndroidMarketUrl %>">
					<img alt="Android app on Google Play" src="http://www.android.com/images/brand/android_app_on_play_logo_small.png" />
				</a>
			<% } %>
			<div class="clear"></div>
		</footer>

	</article>

    <% if (!String.IsNullOrEmpty(Model.CurrentProject))
       {
           Html.RenderPartial("Blogs", Model.BlogEntries);
       } %>
<% } %>